package lambda;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author 10843
 */
public class LambdaDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("###");
        list.add("#########");
        list.add("#####");
        list.add("#");
        list.add("######");
        list.add("####");
        list.add("#######");
        list.add("##");

        Comparator<String> c = (String o1,String o2)->{
            return o1.length() - o2.length();
        };
        Comparator<String> c2 = (o1,o2)->{
          return o1.length() - o2.length();
        };
        Comparator<String> c3 = (o1,o2)->o1.length()-o2.length();
//        Collections.sort(list,c);
        //都一样
        list.sort(c);
        for(String s : list){
            System.out.println(s);
        }

    }
}
